const Router = require('koa-router')

const goodsRouter = new Router({prefix:'/goods'})
const { verifyAuth } = require('../middleware/authMiddleware')
const {
  getGoods,
  addGoods,
  getGoodsById,
  updateGoods,
  removeGoods
} = require('../controller/goodsController')
//获取商品列表
goodsRouter.get('/', verifyAuth, getGoods)
//添加商品
goodsRouter.post('/', verifyAuth, addGoods)
//查询商品
goodsRouter.get('/:id',verifyAuth,getGoodsById)
//编辑商品
goodsRouter.put('/:id', verifyAuth, updateGoods)
//删除商品
goodsRouter.delete('/:id',verifyAuth,removeGoods)
module.exports = goodsRouter